package com.zhangmeng.online.exam.entity;

import com.zhangmeng.online.exam.entity.baseEntity.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

/**
 * description: 学科
 * @author zm
 * @date 2025/2/28 16:18
 * @version: 1.0
 */
@NoArgsConstructor
@Data
@AllArgsConstructor
@Entity
@EqualsAndHashCode(callSuper = false)
@Table(name = "subject")
public class Subject extends BaseEntity<Long> {

    private String name;//学科名称

    private String code;//学科代码

    private String description;//学科描述

    @ManyToOne(fetch = FetchType.LAZY)
    private Profession profession;//职业

    @OneToMany(mappedBy = "subject")
    private List<Question> questions = new ArrayList<>();//题目列表
}
